<?php
/**
 ***** 扶摇而上、抱守本真 ******
 * @author Dana
 * @Date 2021/6/22
 */

class Store{
    // 列出 source 和 supper 作为合法属性
    protected $__data = ['source'=>false, 'supper'=>false];

    public function __get($property)
    {
        if(isset($this->__data[$property])){
            return $this->__data[$property];
        }else{
            return false;
        }
    }

    // 限定只能设置
    // 预定义的属性
    public function __set($property, $value)
    {
        if(isset($this->__data[$property])){
            $this->__data[$property] = $value;
        }else{
            return false;
        }

    }

}

$johnwood = new Store();
$johnwood->email = 'johnwood@qq.com';
print $johnwood->email;

$johnwood->source = 'New York';
print $johnwood->source;
